<?php
include($_SERVER['DOCUMENT_ROOT'] . '/Biohof/inc/application_settings.php');

$target = (isset($_REQUEST['T'])) ? $_REQUEST['T'] : null;
$newsId = (isset($_REQUEST['NEWS_ID'])) ? $_REQUEST['NEWS_ID'] : null;
$response = '';

switch ($target) {
	case 'LONG_INFO':
		$response = getNewsLongInfo($newsId);
		break;
}


echo $response;


/**
 * returns the long info for given news id
 * @param 		int		 $newsId
 * @return		string	 $longInfo
 */
function getNewsLongInfo($newsId){
	$longInfo = '';
	if (is_numeric($newsId)){
		$sqlObj = Sql_Object::getInstance();
		$sqlObj->connect();
		
		$langCode = (LANGUAGE == GERMAN) ? 'de' : 'en';
		$sql = 'select long_info_' . $langCode . ' from ' . DB_BIO . '.news_view where news_id = ?';
		$params = array($newsId);
		
		$sqlObj->execute($sql, $params);
		if (($row = $sqlObj->fetch()) != null)
			$longInfo = $row['long_info_' . $langCode];
		$sqlObj->disconnect();
	}
	return $longInfo;
}
?>